#ifndef __BERNSTEIN_H__
#define __BERNSTEIN_H__

#include "Vector4.h"

class Bernstein{
 public:
 Bernstein(Vector4 p0, Vector4 p1, Vector4 p2, Vector4 p3) : p0(p0), p1(p1), p2(p2), p3(p3)
	{
		
	}

	static double B0(double t) {
		return -t*t*t + 3*t*t - 3*t + 1;
	}

	static double B1(double t) {
		return 3*t*t*t - 6*t*t + 3*t;
	}

	static double B2(double t) {
		return -3*t*t*t + 3*t*t;
	}

	static double B3(double t) {
		return t*t*t;
	}

	Vector4 evaluate(double t) {
		return B0(t)*p0 + B1(t)*p1 + B2(t)*p2 + B3(t)*p3;
	}

	void print() {
		p0.print();
		p1.print();
		p2.print();
		p3.print();
	}
 private:
	Vector4 p0,p1,p2,p3;

};



#endif
